﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Reflection;
using System.Text;

namespace QQ.AbstractFactory
{
    class Program
    {
        public static void Main(string[] args)
        {
            ConfigurationManager.AppSettings.Set("factory", "QQ.AbstractFactory.WindowsSkin");
            //读取配置文件
            var factoryType = ConfigurationManager.AppSettings["factory"];

            //反射生成对象
            var factory = (ISkin)Assembly.Load("QQ.AbstractFactory").CreateInstance(factoryType);
            factory.ShowAll();

            ConfigurationManager.AppSettings.Set("factory", "QQ.AbstractFactory.MacSkin");
            //读取配置文件
            factoryType = ConfigurationManager.AppSettings["factory"];

            //反射生成对象
            factory = (ISkin)Assembly.Load("QQ.AbstractFactory").CreateInstance(factoryType);
            factory.ShowAll();


            Console.ReadKey();
        }
    }
}
